#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>

void bubble_sort(int arr[], int len, int K);

int main(int argc, char const* argv[])
{
	int N, K;
	int* arr = NULL;

	while (!scanf("%d %d", &N, &K));

	arr = (int*)malloc(N * sizeof(int));

	for (int i = 0; i < N; i++)
	{
		while (!scanf("%d", arr + i));
	}

	bubble_sort(arr, N, K);

	for (int i = 0; i < N; i++)
	{
		printf("%d", *(arr + i));
		if (i != N - 1)
			putchar(' ');
	}

	free(arr);
	return 0;
}

void bubble_sort(int arr[], int len, int K)
{
	int i, j, temp;
	for (i = 0; i < K; i++)
		for (j = 0; j < len - 1; j++)
			if (arr[j] > arr[j + 1])
			{
				temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
}